<?php
	header("Content-type: application/x-javascript");
?>
Ext.define('AmpleHarvest.Data.Store.statistics.Process.ProcessingDetailStore', {
    extend : 'Ext.data.Store',
    model : 'AmpleHarvest.Data.Model.statistics.Process.ProcessingDetailModel',
    autoLoad : true,
    remoteSort : 'true',

    sorters : {
        property : 'procStart',
        direction : 'ASC'
    },

    constructor : function (config) {
        this.proxy = {
            type : 'ajax',
            url : AmpleHarvest.util.UrlBuilder
                    .getProcessingDetailsUrl(config.timestamp),
            timeout : '300000',
            method : 'GET',
            startParam : 'offset',
            reader : {
                type : 'json',
                root : 'collection',
                totalProperty : 'totalCount'
            },
            simpleSortMode : true,
            afterRequest : function (request, success) {
                if (success) {
                    this.lastRequest = request.params;
                }
            },
            lastRequest : {},
            timestamp : config.timestamp
        };
        this.callParent(arguments);
    },
    
    getLastRequest : function () {
        return this.proxy.lastRequest;
    },
    
    getLastRequestNoLimit : function () {
        var noLimitParams = Ext.clone(this.proxy.lastRequest);
        Ext.destroyMembers(noLimitParams, 'start', 'limit');
        
        return noLimitParams;
    }
});